<html>
<head>
<script src="/private/system/public/js/mootools.js"></script>
<script src="/private/system/public/js/ajaxrq.js"></script>
<script>

window.addEvent('domready', function(){
$('testQueue').addEvent('click', function(){

	ajaxRq.QueueRequest(new AjaxPostRequest({
	    test: 'ok'
	},{
	    $action: 'view',
	    $clsid: 'Module',
	    $id: '2'
	},{
		callback: function(rs){$$('body').appendText("R1");},
		raw: true
	}));
	ajaxRq.QueueRequest(new AjaxPostRequest({
	    test: 'ok'
	},{
	    $action: 'view',
	    $clsid: 'Module',
	    $id: '2'
	},{
		callback: function(rs){$$('body').appendText("R2");},
		raw: true
	}));
	ajaxRq.QueueRequest(new AjaxPostRequest({
	    test: 'ok'
	},{
	    $action: 'view',
	    $clsid: 'Module',
	    $id: '2'
	},{
		callback: function(rs){$$('body').appendText("R3");},
		raw: true
	}));

	ajaxRq.Execute(function(){$$('body').appendText("Done"); });

})


$('testPage').addEvent('click', function(){
	
	ajaxRq.Dispatch(new AjaxGetRequest({
		$action: 'view',
		$clsid: 'Page',
		$id: $random(1,50)
	},{
		callback: function(rq){
			$('main').setHTML(rq.request.response.text);
		}, raw: true
	}));
	
});


});
</script>
</head>

<body>

<button id="testQueue">Test Queue</button>
<button id="testPage">Load a Page</button>

<div id="main">
&nbsp;
</div>

</body>
